import request from '@/utils/request'

// 获取验证码
export function verification() {
  return request({
    url: '/captchaImage',
    method: 'get'
  })
}

// 登录接口
export function login(data) {
  return request({
    url: '/login',
    // url: '/vue-admin-template/user/login',
    method: 'post',
    data,
  })
}

/*
export function logout() {
  return request({
    url: '/vue-admin-template/user/logout',
    method: 'post'
  })
}*/

export function logout(token) {
  return request({
    url: '/monitor/online/' + token,
    method: 'delete'
  })
}

// 获取个人信息
export function getInfo() {
  return request({
    url: '/system/user/profile',
    method: 'get'
  })
}

// 修改个人信息
export function updateProfile(data) {
  return request({
    url: '/system/user/profile',
    method: 'put',
    data
  })
}

// 修改密码
export function updatePwd(params) {
  return request({
    url: '/system/user/profile/updatePwd',
    method: 'put',
    params
  })
}

// 获取用户列表
export function getUserList(params) {
  return request({
    url: '/system/user/list',
    method: 'get',
    params
  })
}

// 导出用户
export function exportUser() {
  return request({
    url: '/system/user/export',
    method: 'get',
  })
}

// 导入用户
export function importUser() {
  return request({
    url: '/system/user/importData',
    method: 'post',
  })
}

// 用户详情
export function userDetails(userId) {
  return request({
    url: '/system/user/'+userId,
    method: 'get',
  })
}

export function delUser(userId) {
  return request({
    url: '/system/user/' + userId,
    method: 'delete'
  })
}

export function addUser(data) {
  return request({
    url: '/system/user',
    method: 'post',
    data
  })
}

export function updateUser(data) {
  return request({
    url: '/system/user',
    method: 'put',
    data
  })
}

